package main

import "fmt"

func getError(index int) {

	arr := [3]int{1, 2, 3}

	defer func() {
		if r := recover(); r != nil {
			fmt.Println("数组角标越界！")
		}
	}()
	fmt.Println(arr[index])
	//数组角标越界

}

func main() {
	getError(4)
}
